package com.dm.saleassback.standardmanage.controller;

import com.dm.saleassback.standardmanage.service.StandardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.sql.SQLException;
import java.util.Map;

@Controller
@Transactional
@CrossOrigin
public class StandardController {
    @Autowired
    private StandardService standardService;

    /**
         * @Description 查询岗位标准
         * @Author zhangxue
         * @Date 16:56 2018/5/31
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/queryAllStandard",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> queryAllStandard(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = standardService.queryAllStandard(param);
        return statusMap;
    }


    /**
     * @Description 新增岗位标准信息
     * @Author zhangxue
     * @Date 15:05 2018/6/1
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/saveStandard",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveStandard(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = standardService.saveStandard(param);
        return statusMap;
    }

    /**
     * @Description 删除岗位标准信息
     * @Author zhangxue
     * @Date 15:06 2018/6/1
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/deleteStandardById",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> deleteStandardById(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = standardService.deleteStandardById(param);
        return statusMap;
    }

    /**
     * @Description 修改岗位标准信息
     * @Author zhangxue
     * @Date 15:09 2018/6/1
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/updateStandardById",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> updateStandardById(@RequestBody Map<String,Object> param, HttpSession session){
        Map<String,Object> statusMap = standardService.updateStandardById(param);
        return statusMap;
    }

}
